<!DOCTYPE html>
<html>
<head>
	<link rel="shortcut icon" href="__STATIC__/layout/favicon.ico">
<link href="__STATIC__/layout/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
<link href="__STATIC__/layout/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
<link href="__STATIC__/layout/css/animate.css" rel="stylesheet">
<link href="__STATIC__/layout/css/style.css?v=4.1.0" rel="stylesheet">
<link href="__STATIC__/layout/css/channel.css?v=4.1.0" rel="stylesheet">
<!-- Sweet Alert -->
<link href="__STATIC__/layout/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">


    <link rel="stylesheet" href="__STATIC__/layout/css/demo.css" type="text/css">
    <link href="__STATIC__/layout/css/gyq.css" rel="stylesheet">
</head>
<body class="white-bg" style="color:#333;padding:3px;">
   <div class="page-heade">
          <h2 class="title_color text-center">网点需汇报产品修改</h2>
   </div>
<div class="padding-10">
  网点<b>宝泰吉之岛分店</b>需汇报产品
</div>
<form action="" class="form-inline">
	<table class="table table-bordered table-hover bud_hei" id="editable">
    <tr>
      <td colspan="6">
           <div class="input-group">
                            <input id="area_id" type="text" placeholder="请输入关键字或空格查询"
                                   class="form-control" value="" style="min-width: 300px;width: 300px">
                            <div class="input-group-btn">
                                <ul class="dropdown-menu dropdown-menu-right" role="menu">
                                </ul>
                            </div>
                        </div>
                    </div>
                    <a href="javascript:;" id="select_area" class="btn btn-primary btn-sm">选择</a>
      </td>
    </tr>
    <tr>
      <td colspan="6">要添加的产品是：<div class="form-group" id="areatext"></div></td>
    </tr>
    <tr>
      <td colspan="6" class="text-left"><a href="javascript:;" class="btn-sm btn btn-info" id="addnew">添加</a><span class="lr_5"></span> <a href="javascript:;" class="btn btn-sm btn-danger" id="del_this">删除</a><span class="lr_5"></span> <a href="javascript:;" class="btn btn-sm btn-warning" id="fanhui">返回</a></td>
    </tr>
	<tr class="info">
            <td style="vertical-align: middle !important;text-align: center;width: 3%">
              <input type="checkbox" name="items" id="checkAll">
            </td>
            <td class="text-center">序号</td>
            <td class="text-center" style="width: 300px">产品名</td>
            <td class="text-center">单位</td>
            <td class="text-center">公司标准零售价(元)</td>
            <td class="text-center">操作</td>
          </tr>
              <tr>
                   <td class="text-center"><input type="checkbox" name="items"></td>
                    <td class="text-center">1</td>
                    <td class="text-left">01豆沙粽</td>
                    <td class="text-center">袋</td>
                    <td class="text-right">31.20</td>
                    <td class="text-center"><a href="javascript:;" class="del_this">删除</a></td>
              </tr>
              <tr>
                   <td class="text-center"><input type="checkbox" name="items"></td>
                    <td class="text-center">2</td>
                    <td class="text-left">03台式风味粽</td>
                    <td class="text-center">袋</td>
                    <td class="text-right">39.00</td>
                    <td class="text-center"><a href="javascript:;" class="del_this">删除</a></td>
              </tr>
                <tr>
                   <td class="text-center"><input type="checkbox" name="items"></td>
                    <td class="text-center">3</td>
                    <td class="text-left">04栗子咸肉粽</td>
                    <td class="text-center">袋</td>
                    <td class="text-right">39.00</td>
                    <td class="text-center"><a href="javascript:;" class="del_this">删除</a></td>
              </tr>
               <tr>
                   <td class="text-center"><input type="checkbox" name="items"></td>
                    <td class="text-center">4</td>
                    <td class="text-left">05五香咸肉粽</td>
                    <td class="text-center">袋</td>
                    <td class="text-right">39.00</td>
                    <td class="text-center"><a href="javascript:;" class="del_this">删除</a></td>
              </tr>
	</table>
</form>
    <h5 class="text-center"  style="font-size: 13px;font-weight: 500">
                    总共有12条记录，第1/2页,当前页<input id="page" type="text"  style="width: 40px" value="1"/><span id="gopage">Go</span>&nbsp;&nbsp;<span id="fistpage">首页</span>&nbsp;&nbsp;
                    每页显示
                    <select id="pagesize">
                        <option value='10' selected>10条</option>
                        <option value='15'>15条</option>
                        <option value='20'>20条</option>

                    </select>
                </h5>
    <!-- <h3 class="text-center"><img src="__STATIC__/layout/img/zwsj.png"></h3> -->

<script src="__STATIC__/layout/js/jquery.min.js"></script>
<script src="__STATIC__/layout/js/contabs_sub.js"></script>
<script src="__STATIC__/layout/js/bootstrap.min.js?v=3.3.6"></script>
<!-- Sweet alert -->
<script src="__STATIC__/layout/js/plugins/sweetalert/sweetalert.min.js"></script>
<script src="__STATIC__/layout/js/contabs_sub.js"></script>
<script src="__STATIC__/layout/js/plugins/suggest/bootstrap-suggest.min.js"></script>
<script src="__STATIC__/layout/js/plugins/layer/layer.min.js"></script>
  <script>
     $("#fanhui").click(function(){
       history.go(-1)
     }) 

     $("#addnew").click(function(){
          var $items = $("[name=items]:checkbox")
            if ($items.filter(':checked').length < 1) {
                sweetAlert("", "请至少选择一个商品！", "error");
            } else if($("#areatext").text()=="") {
               sweetAlert("", "请至少选择一个商品！", "error");
            }else{
              return false
            }

     })
/*反选*/


          /*table表格操作*/
      $("#checkAll").click(function() {

            $("[name=items]:checkbox").prop("checked", $(this).prop("checked"));
            if ($("[name=items]:checkbox").prop("checked") != true) {
                // console.log($(this))
                $("[name=items]:checkbox").parents("tr").css("backgroundColor", "#fff")
            } else {
                $("[name=items]:checkbox").parents("tr").css("backgroundColor", "#f8f800")

            }
        })
        $("[name=items]:checkbox").click(function() {
            //定义一个临时变量，避免重复使用同一个选择器选择页面中的元素，提高程序效率
            // console.log(1)
            var $tmp = $("[name=items]:checkbox");
            if ($(this).prop("checked") != true) {
                // console.log($(this))
                $(this).parent().parent().css("backgroundColor", "#fff")
            } else {
                $(this).parent().parent().css("backgroundColor", "#f8f800")

            }
            //用filter()方法筛选出选中的复选框，并直接给CheckedAll赋值
            $("#checkAll").prop('checked', $tmp.length == $tmp.filter(':checked').length);

          })



   /*删除*/
   $("#del_this").click(function() {
            // $("#alert_addNewZone").show();
            var $items = $("[name=items]:checkbox")
            if ($items.filter(':checked').length < 1) {
                sweetAlert("", "请至少选择一个要删除的产品！", "error");
            } else {
              $items.each(function(){ 
                if( $(this).is(':checked')){
                   $(this).parent().parent().remove();
                  }
        }); 
            }
        });

   $(document).on("clcik",".del_this",function(){

   })
  </script>
</body>
</html>